﻿using BenchmarkDotNet.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BenchMarkTest.BenchCase.MutipleRuntime
{
    /// <summary>
    /// 多版本性能测试
    /// </summary>
    [Config(typeof(MultipleRuntimes))]
    public class TestClass
    {
        [Benchmark]
        public void LocalVar()
        {
            int a = 256;
            int sum = 0;
            for (int i = 0; i < int.MaxValue; i++)
            {
                sum += 129 * a;
                sum = 0;
            }
        }

        [Benchmark]
        public void ConstVar()
        {
            const int a = 256;
            int sum = 0;
            for (int i = 0; i < int.MaxValue; i++)
            {
                sum += 129 * a;
                sum = 0;
            }
        }
    }
}
